<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=7" />
    <title>找回密码</title>
    <script type="text/javascript" src="/static/js/jquery.min.js"></script>
    <script type="text/javascript" src="/static/js/formvalidator.js" charset="UTF-8"></script>
    <script type="text/javascript" src="/static/js/formvalidatorregex.js" charset="UTF-8"></script>
    <link href="/static/css/reset.css" rel="stylesheet" type="text/css" />
    <link href="/static/css/table_form.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .submit,.pass-logo a,.form-login .input label,.item span,#content h2 span em{display:inline-block;display:-moz-inline-stack;zoom:1;*display:inline;}
        .blue a{color:#377abe},.submit input{cursor:hand;}
        .log{line-height:24px; height:24px;float:right; font-size:12px}
        .log span{color:#ced9e7}
        .log a{color:#049;text-decoration: none;}
        .log a:hover{text-decoration: underline;}
        #header{ height:94px; background:url(/static/images/h.png) repeat-x}
        #header .content{width:920px; margin:auto; height:60px;padding:10px 0 0 0}
        #content{width:920px; margin:auto; padding:36px 0 0 0}
        #content{width:920px; margin:auto; padding:20px 0 0 0; overflow:auto}
        .form-login{width:420px; padding-left:40px}
        #content h2{font-size:25px;color:#494949;border-bottom: 1px dashed #CCC;padding-bottom:3px; margin-bottom:10px}
        #content h2 span{font-size:12px; font-weight:normal}
        #content h2 span em{background: url(/static/images/order.png) no-repeat 0px -16px; width:15px; height:15px; line-height:15px; text-align:center; margin-right:5px; color:#FFF}
        #content h2 span.on em{background-position: 0px 0px;}
        .form-login .input{ padding:7px 0; overflow:hidden; clear:both}
        .form-login .input label{ width:84px;font-size:14px; color:#8c8686; text-align:right; float:left}
        .reg{padding:0 0 0 84px}
        .take .submit{margin-top:10px}
        .form-login .hr hr{ display:none}
        .form-reg{padding:10px 0 0 14px; width:700px;}
        .form-reg .input label{ width:120px}
        .form-reg .input label.type{ width:auto; color:#000; padding-right:10px}
        .form-reg .reg{padding:10px 0 0 120px}
        .form-reg .reg .submit{ margin-bottom:5px}
        .submit{padding-left:3px}
        .submit,.submit input{ background: url(/static/images/but.png) no-repeat; height:29px;}
        .submit input{background-position: right top; border:none; padding:0 10px 0 7px; font-size:14px}
        .reg{ color:#666; line-height:24px}
        .reg .submit{background-position: left -35px; height:35px}
        .reg .submit input{background-position: right -35px; font-weight:700; color:#fff; height:35px}
        .reg-auto p{ margin-bottom:10px; color:#666;}
        .col-1 .title{color:#386ea8; padding:5px 10px 3px}
        .col-1 div.content{padding:0px 10px 10px}
        .col-1 div.content h5{background: url(/static/images/ext-title.png) no-repeat 2px 10px; height:34px}
        .col-1 div.content h5 strong{ visibility: hidden}
        .pass-logo a img{ border:1px solid #ddd}
        .pass-logo a{border:3px solid #fff}
        .pass-logo a.logo,
        .pass-logo a:hover{border:3px solid #e8f1f1;}
        .pass-logo p{border-top: 1px solid #e1e4e8; padding-top:15px}
        .item span{ color:#8c8686}
        #footer{color:#666; line-height:24px;width:920px; margin:auto; text-align:center; padding:12px 0; margin-top:52px; border-top:1px solid #e5e5e5}
        #footer a{color:#666;}
        .point{border:1px solid #ffbf7a; background:#fffced; margin-bottom:10px; margin-right:100px;margin-left:50px;position:relative}
        .point .content{padding:8px 10px;}
        .point .content .title{color:#ff8400}
        .point .content p{color:#777; text-indent:20px}
    </style>
</head>
<body>
<div id="header">
    <div class="content">
        <span class="rt log"></span>
    </div>
</div>
<div id="content">
    <h2>密码找回</h2>
    <form method="post" action="/?c=member&a=do_forget_pwd" id="myform">
        <div class="col-left form-login form-reg">
            <div class="point">
                <div class="content">
                    <strong class="title">注意：</strong>
                    <p>提交后请在24小时内登录邮箱重置会员密码。</p>
                </div>
            </div>
            <div class="input"><label>请输入邮箱：</label><input type="text" id="email" name="email" size="36" class="input-text"></div>
            <div class="input"><label>验证码：</label><input type="text" id="vcode" name="vcode" size="10" class="input-text">
                <img id='code_img' onclick='this.src=this.src+"&"+Math.random()' src=''>
                <a href="javascript:change_vcode();" id="vcode_tip" style="display: none;">看不清，换一张</a>
                <div id="vcodeTip" class=""></div>
            </div>
            <div class="reg">
                <div class="submit"><input type="submit" name="dosubmit" value="提交" style="width:60px"></div>
            </div>
        </div>
    </form>
</div>
<div id="footer">
</div>
<script type="text/javascript">
    var last_vcode = '';//最后一次输入的验证码
    //检验邮箱是否是会员的邮箱
    function check_mail(usermail){
        var tip = $("#emailTip");
        setTimeout(function(){
            if (tip.attr("class")=='onCorrect'){
                $.ajax({
                    type: "POST",
                    dataType: 'json',
                    url : "/?c=member&a=checkmail",
                    data: { mail: usermail},
                    beforeSend: function () { },
                    success: function (data) {
                        if (data.code==0){
                            tip.attr('class','onError');
                            tip.text('帐号不存在');
                            $("input[type=submit]").attr("disabled", true);
                        }else{
                            $("input[type=submit]").attr("disabled", false);
                        }
                    },
                    error :function (XMLHttpRequest, textStatus, errorThrown) {
                        alert(XMLHttpRequest.status);
                        $("input[type=submit]").attr("disabled", false);
                    }
                });
            }
        },1);
    }
    //检验用户输入的验证码是否正确
    function check_vcode(codeval){
        var sid = '<?php echo session_id();?>';
        if (!codeval) return 0;
        $.ajax({
            type: "POST",
            dataType: 'json',
            url : "/?c=member&a=checkvcode",
            data: { vcode: codeval,sid:sid},
            beforeSend: function () { },
            success: function (data) {
                var vcodeTip = $("#vcodeTip");
                if (data.code==0){
                    $("input[type=submit]").attr("disabled", true);
                    vcodeTip.attr('class','onError');
                    vcodeTip.text('验证码错误');
                    $("#vcode").val('').focus();
                    change_vcode();
                }else{
                    $("input[type=submit]").attr("disabled", false);
                    vcodeTip.attr('class','onCorrect');
                    vcodeTip.text('验证码正确');
                }
            },
            error :function (XMLHttpRequest, textStatus, errorThrown) {
                alert(XMLHttpRequest.status);
                $("input[type=submit]").attr("disabled", false);
            }

        });
    }
    //更换验证码图片
    function change_vcode(){
        var code_img = $("#code_img");
        code_img.attr('src','/?c=member&a=show_verify'+"&"+Math.random());
    }
    $(function(){
        $.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}});
        $("#email").formValidator({onshow:"请输入邮箱",onfocus:"邮箱格式错误",oncorrect:"邮箱格式正确"}).inputValidator({min:2,max:32,onerror:"邮箱应该为2-32位之间"}).regexValidator({regexp:"email",datatype:"enum",onerror:"邮箱格式错误"});
        $("#vcode").focus(function (){
            var code_img = $("#code_img");
            if (!code_img.attr('src')){
                $("#vcode_tip").show();
                code_img.attr('src','/?c=member&a=show_verify');
            }
        });
        $("#vcode").blur(function(){
            var codeval = $(this).val();
            if (codeval!=last_vcode){
                check_vcode(codeval);
            }
            last_vcode = codeval;
        });
        $("#email").blur(function(){
            var mail_account = $(this).val();
            if (mail_account){
                check_mail(mail_account);
            }
        });
    });
</script>
</body>
</html>